<?php
/*
 * Recupero le news Feed dell'utente corrente
 */
$facebook = MyFacebook::getInstance();
$uid = $facebook->getUser();
echo "<h1>Il mio uid: $uid</h1>";
$home = $facebook->api("/".$uid."/home");
if ($home) {
  //var_dump($home);
  foreach($home["data"] as $feedItem) {
      echo "<p>";
      //if ($feedItem["type"] == "")
      switch ($feedItem["type"]) {
        case "link":
          echo "<h2>Link</h2>";
          Renderer::renderLink($feedItem);
          break;
        case "video":
          echo "<h2>Video</h2>";
          Renderer::renderVideo($feedItem);
          break;
        case "status":
          echo "<h2>Stato</h2>";
          Renderer::renderStatus($feedItem);
          break;
        case "photo":
          echo "<h2>Foto</h2>";
          Renderer::renderPhotos($feedItem);
          break;
        default:
          echo "Tipo non conosciuto: ".$feedItem["type"];
      }
      
      echo "</p>";
  }
} else {
  echo "<p>Nessuna News Feed Recuperata</p>";
}
